#!/bin/bash
GROUP=amonsys
USER=amonsys

if [ $UID -eq 0 ]
then
	cp amonsys /usr/sbin/
	mkdir -p /var/log/amonsys/ /usr/lib/amonsys/
	cp filez/* / -R

	if [ -z "`grep $GROUP /etc/group`" ] 
	then
		echo "Creating group $GROUP:"
		addgroup $GROUP
	fi

	if [ -z "`grep $USER /etc/passwd`" ] 
	then
		echo "Creating user $USER:"
		useradd $USER -g $GROUP -d /dev/null -s /bin/false
	fi

	chown $USER.$GROUP /var/log/amonsys/ -R
	chown $USER.$GROUP /usr/lib/amonsys/ -R
	chown $USER.$GROUP /etc/amonsys/ -R
else
	echo "You must to be root!"
fi